package com.zh.streamdemo.demo1;

import java.util.stream.Stream;

public class DemoForeach {

    public static void main(String[] args) {
        Stream.of("Stream1", "Stream2", "Stream3", "Stream4", "Stream5").forEach(System.out::println);
        Stream.of("Stream1", "Stream2", "Stream3", "Stream4", "Stream5").forEach(DemoForeach::formmat);
        Stream.of("Stream1", "Stream2", "Stream3", "Stream4", "Stream5").forEach(item -> {
            System.out.println(item.charAt(item.length()-1));
        });
    }

    private static void formmat(String item){
        item = "foreach-" + item;
        System.out.println(item);
    }
}
